<?php

namespace app\api\model;

use think\Model;

class Order extends BaseModel
{

    protected $hidden = [ 'user_id', 'delete_time', 'update_time' ];
    protected $autoWriteTimestamp = true;

    public static function getSummaryByUser($uid, $page = 1, $size = 15)
    {
        $pagingData = self::where('user_id', '=', $uid)
                ->order('create_time desc')
                ->paginate($size, true, [ 'page' => $page ]);
        return $pagingData;
    }

    /**
     * 根据分页获取订单
     * @param type $page
     * @param type $size
     * @return \think\Paginator
     */
    public static function getSummaryByPage($page = 1, $size = 15)
    {
        $pagingData = self::order('create_time desc')
                ->paginate($size, true, [ 'page' => $page ]);
        return $pagingData;
    }

}
